package com.designpatterns.command.test;

import com.designpatterns.command.entity.Light;
import com.designpatterns.command.command.light.LightOffCommand;
import com.designpatterns.command.command.light.LightOnCommand;
import com.designpatterns.command.control.RemoteControlWithUndo;

/**
 * @author Brook
 */
public class RemoteLoader1 {
    public static void main(String[] args) {
        RemoteControlWithUndo remoteControlWithOndo = new RemoteControlWithUndo();
        Light lightRoom = new Light("living_room");
        LightOnCommand lightOnCommand = new LightOnCommand(lightRoom);
        LightOffCommand lightOffCommand = new LightOffCommand(lightRoom);

        remoteControlWithOndo.setCommand(0,lightOnCommand,lightOffCommand);
        remoteControlWithOndo.onButtonWasPushed(0);
        remoteControlWithOndo.offButtonWasPushed(0);
        System.out.println(remoteControlWithOndo.toString());
        remoteControlWithOndo.undoButtonWasPushed();

        remoteControlWithOndo.offButtonWasPushed(0);
        remoteControlWithOndo.onButtonWasPushed(0);
        System.out.println(remoteControlWithOndo.toString());
        remoteControlWithOndo.undoButtonWasPushed();
    }
}
